| 12345678910111213141516171819202122232425 |
- import { NextResponse } from "next/server";
- import { listYears } from "@/lib/storage";
- export async function GET(request, ctx) {
- const { branch } = await ctx.params;
- console.log("[/api/branches/[branch]/years] params:", { branch });
- if (!branch) {
- return NextResponse.json(
- { error: "branch Parameter fehlt" },
- { status: 400 }
- );
- }
- try {
- const years = await listYears(branch);
- return NextResponse.json({ branch, years });
- } catch (error) {
- console.error("[/api/branches/[branch]/years] Fehler:", error);
- return NextResponse.json(
- { error: "Fehler beim Lesen der Jahre: " + error.message },
- { status: 500 }
- );
- }
- }
|